const Client = require('node-rest-client').Client;
// auth
const Options_auth = { user: "chendong", password: "Chendong@2018" };
var client = new Client(Options_auth);



// 添加Project 版本号 如： http://jira.in.zhihu.com/rest/api/2/project/QA/versions 或 http://jira.in.zhihu.com/rest/api/2/project/QA/version
// 添加版本号必填字段：1. 版本号name 2.项目project对应的Id
// 参考API：https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-version-post

// const projectKey = 'QA';
// const postURL = 'http://jira.in.zhihu.com/rest/api/2/project/' + projectKey + '/version';
const args = {
    data: {
        "description": 'via nodejs 自动插入的版本号, @' + new Date(),
        "name": "1.1.2(78)",
        "projectId": 10119
    },
    headers: { "Accept": "application/json", "Content-Type": "application/json" }
};
client.post('http://jira.in.zhihu.com/rest/api/2/version', args, function(data, response) {
    console.log(data);
});
